const {
  createProxyMiddleware
} = require('http-proxy-middleware');

module.exports = app => {
  // 代理
  app.use(
    '/health',
    createProxyMiddleware({
      // target: 'http://10.59.9.18/',
      target: 'http://172.27.6.139/api ',
      
      changeOrigin: true,
    })
  );
  // 代理
  app.use(
    '/oauth',
    createProxyMiddleware({
      target: 'https://aip.baidubce.com',
      changeOrigin: true,
    })
  );
  // https://aip.baidubce.com/rest/2.0/ocr/
  // 代理
  app.use(
    '/rest',
    createProxyMiddleware({
      target: 'https://aip.baidubce.com/',
      changeOrigin: true,
    })
  );

  app.use(
    '/xxx',
    createProxyMiddleware({
      target: 'http://localhost:8000/',
      changeOrigin: true,
      pathRewrite: {
        '/xxx': ''
      }
    })
  );
}
